<?php
/*
###########################################################################
#                                  KALMAR                                 #
#                      http://akkar.sourceforge.net/                      #
#                                                                         #
#                            -------------------                          #
#                               visspill.php                              #
#                            -------------------                          #
#                                                                         #
#   copyright (C) 2004 Roy W. Andersen                                    #
#   email: ensnared@gmail.com                                             #
#                                                                         #
###########################################################################

###########################################################################
#                                                                         #
#  This program is free software; you can redistribute it and/or modify   #
#  it under the terms of the GNU General Public License as published by   #
#  the Free Software Foundation; either version 2 of the License, or      #
#  (at your option) any later version.                                    #
#                                                                         #
###########################################################################
*/
define('IN_KALMAR', true);
include('common.php');

if (!$_REQUEST['spill_id']) {
	exit($LANG['ERROR']['no_game_selected']);
} else {
	$spill_id = $_REQUEST['spill_id'];
}
include('header.php');

$spillinfo = get_spillinfo($_REQUEST['spill_id']);

echo '
	<h2 align="center">'.$LANG['MISC']['gameinfo'].'</h2>
	<h3 align="center">'.$spillinfo['navn'].'</h3>
	<br>
	<table border="0" align="center" width="50%">
';
foreach ($spillinfo as $key=>$value) {
	switch ($key) {
		case 'spill_id':
		case 'navn':
		case 'rollekonsept':
		case 'paameldingsmal':
		case 'rollemal':
		case 'status':
			break;
		case 'start':
		case 'slutt':
			echo '
			<tr>
				<td><strong>'.$LANG['DBFIELD'][$key].'</strong></td>
				<td>'.ucfirst(strftime($config['long_dateformat'], $value)).'</td>
			</tr>
			';
			break;
		default:
			echo '
			<tr>
				<td><strong>'.$LANG['DBFIELD'][$key].'</strong></td>
				<td>'.$value.'</td>
			</tr>
			';
	}
}
echo '
	</table>
	<br>
';

echo '
<table align="center">
	<tr>
		<td><button onClick="javascript:window.location=\'./spill.php\'">'.$LANG['MISC']['games'].'</button></td>
	</tr>
</table>
';
if ($config['kalmar_paranoid'] != 1) {
	if (is_array(get_paameldinger($spill_id))) {
		$antall_paameldinger = count(get_paameldinger($spill_id));
	} else {
		$antall_paameldinger = 0;
	}
	
	if (is_array(get_roller($spill_id))) {
		$antall_roller = count(get_roller($spill_id));
	} else {
		$antall_roller = 0;
	}
	
	echo '
		<br>
		<br>
		<br>
		<h3 align="center">'.$LANG['MISC']['gamedata'].'</h3>
		<table align="center">
			<tr>
				<td><a href="./paameldinger.php?spill_id='.$spill_id.'">'.$LANG['MISC']['registrations'].'</a></td>
				<td><strong>'.$antall_paameldinger.'</strong></td>
			</tr>
			<tr>
				<td><a href="./roller.php?spill_id='.$spill_id.'">'.$LANG['MISC']['characters'].'</a></td>
				<td><strong>'.$antall_roller.'</strong></td>
			</tr>
		</table>
	';
}
include('footer.php');
?>
